package com.supostacks.xuetanginterfaces.factory;

import com.supostacks.application.application.*;
import com.supostacks.rpc.server.dto.*;
import com.supostacks.rpc.server.req.BaseReq;

public class DefaultFactory {

    public static IBaseApplication getApplication(BaseReq req){
        BaseDto data = req.getData();

        if(data instanceof CategoryDto){
            return BeanFactory.getBean(ICategoryApplication.class);
        }else if (data instanceof UserDto){
            return BeanFactory.getBean(IUserApplication.class);
        }else if(data instanceof ResourceInfoDto){
            return BeanFactory.getBean(IResourceInfoApplication.class);
        }else if(data instanceof GetRecordsDto){
            return BeanFactory.getBean(IGetRecordsApplication.class);
        }else if(data instanceof FeedbackDto){
            return BeanFactory.getBean(IFeedbackApplication.class);
        }else if(data instanceof FileManagementDto){
            return BeanFactory.getBean(IFileManagementApplication.class);
        }else if(data instanceof CardKeyDto){
            return BeanFactory.getBean(ICardKeyApplication.class);
        }

        return null;
    }
}
